 <template>
	<view class="container bar" :class="['wp-'+platform,(modalName=='postdialog'?'wp-blur':'')]">
		<view class="loadimage" v-if="!inited">
			<image :src="splash" mode="aspectFill"></image>
		</view>
		<view class="mainpages page-main" :class="currentbar=='main'?'active':''">
			<view class="main-top">
				<view class="status_bar" v-if="platform!='h5'"></view>
				<view>
					<view class="cu-bar search">
						<view @click="naviTo('lesson/index',{search:1,from:'home'})" class="search-form round bg-white text-center">
							<text class="cuIcon-search" style="font-size: 30upx;"></text>
							<text>{{keyword || '输入关键字搜索'}}</text>
						</view>
						<view class="action">
							<view class="bar-btn btn-scan" @click="doscan"></view>
							<view class="bar-btn" :class="'btn-msg'+(newMsg>0||!hasLogin?'s':'')" @click="naviTo('member/message')"></view>
						</view>
					</view>
				</view>
				
				<!-- 轮播图 -->
				<!-- 轮播图 -->
				<!-- 轮播图 -->
				<!-- 轮播图 -->
				<swiper class="card-swiper square-dot" :indicator-dots="true" :circular="true" :autoplay="true" interval="5000" duration="500" @change="cardSwiper" indicator-color="#F0ECE7" indicator-active-color="#FF5757">
					<swiper-item v-for="(item,index) in slideshow" :class="cardCur==index?'cur':''" v-if="item.status==3">
						<view class="swiper-item" @click="naviTo(item.skip)">
							<image :src="item.imageurl" mode="aspectFill"></image>
						</view>
					</swiper-item>
				</swiper>
				
				<!-- 判断数据后  显示全部课程 专题栏目 讲师风采 。。。。。。 -->
				<!-- 判断数据后  显示全部课程 专题栏目 讲师风采 。。。。。。 -->
				<!-- 判断数据后  显示全部课程 专题栏目 讲师风采 。。。。。。 -->
				<!-- 判断数据后  显示全部课程 专题栏目 讲师风采 。。v-if="data.navs.main.length>0"。。。。 -->
				<view class="cu-list grid no-border" :class="'col-'+mainlistcol" >
					<view class="cu-item" @click="naviTo(item.skip)" v-for="item in menu" v-if="item.status==2">
						<view class="text-center">
							<image class="png radius" :src="item.imageurl"></image>
						</view>
						<text>{{item.title}}</text>
					</view>
				</view>
			</view>
			
			
			<!-- <view class="bg-orange light padding-lr margin-top-sm padding-top-xs" v-if="data.categorys.length>0">
				<view class="cu-list grid nobg no-border" :class="'col-'+categorycol">
					<view class="cu-item nobg" @click="naviTo('lesson/index',{cid:item.id})" v-for="(item, index) in data.categorys" :key="index">
						<view class="text-center margin-lr-xs">
							<image class="png" mode="widthFix" :src="item.cover"></image>
						</view>
					</view>
				</view>
			</view> -->
			
			
			<view class="cu-bar bg-white margin-top-sm" v-if="data.specials.length>0">
				<view class="action">
					<text class="text-bold text-lg text-black text-tagtitle">热门专栏</text>
				</view>
				<view class="action" @click="naviTo('special/index')">
					<view class="text-gray">更多<text class="cuIcon-right"></text></view>
				</view>
			</view>
			
			<!-- 不知道在判断什么  暂时不理会 -->
			<view class="specials" v-if="data.specials.length>0">
				<scroll-view scroll-x="true" class="special-scroll">
					<view class="cu-card article bg-white">
						<view class="cu-item" @click="naviTo('special/detail',{id:item.id})" v-for="(item, index) in data.specials" :key="index">
							<view class="content">
								<image class="cover" :src="item.cover" mode="aspectFill"></image>
								<view class="desc">
									<view class="title">{{item.title}}</view>
									<view class="text-content text-warp">{{item.subtitle}}</view>
									<view>
										<scorebar :score="item.score" size="sm"></scorebar>
									</view>
								</view>
							</view>
						</view>
					</view>
				</scroll-view>
			</view>
			
			<!-- （关注 推荐)是固定的  （课程实录 优秀课程 名师指导 分栏）从数据库中获得 -->
			<!-- （关注 推荐)是固定的  （课程实录 优秀课程 名师指导 分栏）从数据库中获得 -->
			<!-- （关注 推荐)是固定的  （课程实录 优秀课程 名师指导 分栏）从数据库中获得 -->
			<!-- （关注 推荐)是固定的  （课程实录 优秀课程 名师指导 分栏）从数据库中获得 -->
			<scroll-view scroll-x class="bg-white nav" scroll-with-animation>
				<view style="position: relative;" class="cu-item" @tap="naviTo('auth/index',{act:'login'})" v-if="!hasLogin">
					<view class="cu-tag badge" style="top: 20upx; right: 10upx;"></view>
					关注
				</view>
				<view class="cu-item" :class="-1==tabCur?'text-red cur':''" @tap="tabSelect" data-id="-1" v-else>关注</view>
				<view class="cu-item" :class="0==tabCur?'text-red cur':''" @tap="tabSelect" data-id="0">
					推荐
				</view>
				<view class="cu-item" :class="item.id==tabCur?'text-red cur':''" v-for="(item,index) in typelist" :key="index" @tap="tabSelect" :data-id="item.id">
					{{item.name}}
				</view>
			</scroll-view>
			<!-- 课程实录  -->
			<!-- 课程实录  -->
			<!-- 课程实录  -->
			<!-- 课程实录  -->
			<view class="padding-sm bg-white">
				<view class="flex">
					<view class="flex-sub cu-card case lessons waterfall">
						<view @click="naviTo('lesson/detail',{id:item.id})" class="cu-item" :class="index%2==0?'':'hide'" v-for="(item, index) in data.lessons" :key="index">
							<view v-if="index%2==0">
								<view class="image radius">
									<image :src="item.imgurl" mode="widthFix"></image>
									<view class="cu-tag bg-black text-white">{{item.studynumber}}人已学</view>
								</view>
								<view class="title lg text-cut text-bold padding-top-xs">s{{item.coursebrief}}</view>
								<view class="cu-list menu">
									<view class="cu-item">
										<view class="content">
											<image :src="item.lecturer_img" class="png round" mode="aspectFit"></image>
											<text class="text-gray">{{item.coursename}}</text>
										</view>
										<view class="action">
											<text class="text-red" v-if="iospay || device!='ios'">{{item.courseprice>0?'￥'+item.courseprice:'免费'}}</text>
											<text class="text-gray" v-else>{{item.updating==null?'连载':'完结'}}</text>
										</view>
									</view>
								</view>
							</view>
						</view>
					</view>
					<view class="flex-sub cu-card case lessons waterfall">
						<view @click="naviTo('lesson/detail',{id:item.id})" class="cu-item" :class="index%2==1?'':'hide'" v-for="(item, index) in data.lessons" :key="index">
							<view v-if="index%2==1">
								<view class="image radius">
									<image :src="item.imgurl" mode="widthFix"></image>
									<view class="cu-tag bg-black text-white">{{item.studynumber}}人已学</view>
								</view>
								<view class="title lg text-cut text-bold padding-top-xs">{{item.coursebrief}}</view>
								<view class="cu-list menu">
									<view class="cu-item">
										<view class="content">
											<image :src="item.lecturer_img" class="png round" mode="aspectFit"></image>
											<text class="text-gray">{{item.coursename}}</text>
										</view>
										<view class="action">
											<text class="text-red" v-if="iospay || device!='ios'">{{item.courseprice>0?'￥'+item.courseprice:'免费'}}</text>
											<text class="text-gray" v-else>{{item.updating?'连载':'完结'}}</text>
										</view>
									</view>
								</view>
							</view>
						</view>
					</view>
					
				</view>
			</view>



			<!-- 判断刷新后还有没有其他数据 -->
			<!-- 判断刷新后还有没有其他数据 -->
			<!-- 判断刷新后还有没有其他数据 -->
			<!-- 判断刷新后还有没有其他数据 -->
			<view class="text-center padding-top-sm bg-white" v-if="loadmore.main=='more'">
				<view class="loadmore">
					<image src="@/static/images/img_home_showmore.png" class="png"></image>
				</view>
			</view>
			
			
			<uni-load-more class="bg-white" :status="loadmore.main" :contentText="contentText"></uni-load-more>
			
			
			<view class="text-center padding bg-white padding-bottom-xl" @click="naviTo('lesson/index')">
				<text class="text-blue">查看全部课程</text>
			</view>
		</view>
		
		
		 <view class="mainpages page-explore" :class="currentbar=='explore'?'active':''">
			 <!-- 发现页面 顶部 -->
			<div class="explore-top">
				<view class="status_bar" v-if="platform!='h5'"></view>
				<scroll-view scroll-x  scroll-with-animation>
					<view class="cu-list no-border">
						<view class="cu-item" v-if="explores.entrys.lesson==1" @click="naviTo('lesson/index',{search:1,from:'home'})">
							<view class="text-center">
								<image class="png" src="@/static/images/icon/explore_lesson.png"></image>
							</view>
							<text>课程</text>
						</view>
						<view class="cu-item" v-if="explores.entrys.special==1" @click="naviTo('special/index')">
							<view class="text-center">
								<image class="png" src="@/static/images/icon/explore_special.png"></image>
							</view>
							<text>专栏</text>
						</view>
						<view class="cu-item" v-if="explores.entrys.lector==1" @click="naviTo('lector/index')">
							<view class="text-center">
								<image class="png" src="@/static/images/icon/explore_lector.png"></image>
							</view>
							<text>讲师</text>
						</view>
						<view class="cu-item" v-if="shopstate==1 && explores.entrys.shop==1" @click="naviTo('shop/index')">
							<view class="text-center">
								<image class="png" src="@/static/images/icon/explore_goods.png"></image>
							</view>
							<text>商城</text>
						</view>
						<view class="cu-item" v-if="explores.entrys.works==1" @click="naviTo('diary/works')">
							<view class="text-center">
								<image class="png" src="@/static/images/icon/explore_works.png"></image>
							</view>
							<text>作品</text>
						</view>
						<view class="cu-item" v-if="explores.entrys.diary==1" @click="naviTo('diary/index')">
							<view class="text-center">
								<image class="png" src="@/static/images/icon/explore_note.png"></image>
							</view>
							<text>日记</text>
						</view>
					</view>
				</scroll-view>
			</div>

			<!-- 课程推荐  与更多 -->
			<view class="cu-bar bg-white solid-bottom margin-top-sm">
				<view class="action">
					<text class="text-bold text-xl text-black text-tagtitle">课程推荐</text>
				</view>
				<view class="action" @click="naviTo('lesson/index',{search:1,from:'home'})">
					<view class="text-gray">更多<text class="cuIcon-right"></text></view>
				</view>
			</view>
			<!-- 组件 -->
			<!-- 组件 -->
			<!-- 组件 -->
			<!-- 组件 -->
			<!-- 组件 -->
			<!-- 轮播图 -->
			<!-- 轮播图 -->
			<!-- 轮播图 -->
			<!-- 轮播图 -->
			<view class="scrollx-image padding-sm">
				<scroll-view scroll-x="true" scroll-left="0" class="special-scroll cu-list scrollx" scroll-with-animation>
					<view @click="naviTo('lesson/detail',{id:item.id})" class="cu-item image margin-xs radius shadow" v-for="(item,index) in this.data.excellentLessons" :key="index">
						<image :src="item.imgurl" mode="aspectFill"></image>
						<view class="title">{{item.coursebrief}}</view>
					</view>
				</scroll-view>
			</view>
			
			<view class="cu-bar bg-white" v-if="data.specials.length>0">
				<view class="action">
					<text class="text-bold text-xl text-black text-tagtitle">热门专栏</text>
				</view>
				<view class="action" @click="naviTo('special/index')">
					<view class="text-gray">更多<text class="cuIcon-right"></text></view>
				</view>
			</view>
			
			
			<view class="specials" v-if="data.specials.length>0">
				<scroll-view scroll-x="true" class="special-scroll">
					<view class="cu-card article bg-white">
						<view class="cu-item shadow" @click="naviTo('special/detail',{id:item.id})" v-for="(item, index) in data.specials" :key="index">
							<view class="content">
								<image class="cover" :src="item.cover" mode="aspectFill"></image>
								<view class="desc">
									<view class="title">{{item.title}}</view>
									<view class="text-content text-warp">{{item.subtitle}}</view>
									<view>
										<scorebar :score="item.score" size="sm"></scorebar>
									</view>
								</view>
							</view>
						</view>
					</view>
				</scroll-view>
			</view>
			
			
			<view class="cu-bar bg-white margin-top-sm">
				<view class="action">
					<text class="text-bold text-xl text-black text-tagtitle">优秀讲师</text>
				</view>
				<view class="action" @click="naviTo('lector/index')">
					<view class="text-gray">更多<text class="cuIcon-right"></text></view>
				</view>
			</view>
			
			<!-- 读取优秀讲师列表 -->
			<!-- 读取优秀讲师列表 -->
			<!-- 读取优秀讲师列表 -->
			<!-- 读取优秀讲师列表 -->
			<view class="scrollx-image padding-sm">
				<scroll-view scroll-x="true" scroll-left="0" class="special-scroll cu-list scrollx" scroll-with-animation>
					<view @click="naviTo('lector/detail',{id:item.id})" class="cu-item image margin-xs radius shadow" v-for="(item,index) in this.data.lecturer" :key="index">
						<image :src="item.lecturer_Img" mode="aspectFill"></image>
						<view class="title">{{item.name}}</view>
					</view>
				</scroll-view>
			</view>
			
			
			<view class="cu-bar bg-white margin-top-sm" v-if="explores.goods.length>0">
				<view class="action">
					
					<text class="text-bold text-xl text-black text-tagtitle">商品推荐</text>
				</view>
				<view class="action" @click="naviTo('shop/index')">
					<view class="text-gray">更多<text class="cuIcon-right"></text></view>
				</view>
			</view>
			<view class="padding-xs grid col-3 goods" v-if="explores.goods.length>0">
				<view @click="naviTo('shop/goods',{id:item.id})" class="padding-xs goods-item bg-white" v-for="(item, index) in explores.goods" :key="index">
					<image :src="item.thumb" mode="aspectFit"></image>
					<view class="title">{{item.title}}</view>
					<view class="price"><text class="left">￥{{item.marketprice}}</text></view>
				</view>
			</view>
			<view class="cu-bar margin-top-sm">
				<view class="action">
					<view class="content-nav nav noaf">
						<view class="cu-item" :class="exploreshow=='works'?'cur':''" @click="exploreshow='works'">作品</view>
						<view class="cu-item" :class="exploreshow=='works'?'':'cur'" @click="exploreshow='index'">日记</view>
					</view>
				</view>
				<view class="action">
					<view class="text-gray" @click="naviTo('diary/'+exploreshow)">更多<text class="cuIcon-right"></text></view>
				</view>
			</view>
			<view>
				<view class="padding" v-if="exploreshow=='works'">
					<view class="flex" v-if="explores.works.length>0">
						<view class="flex-sub cu-card case lessons waterfall">
							<view class="cu-item" :class="index%2==0?'':'hide'" v-for="(item, index) in explores.works" :key="index">
								<view @click="naviTo('diary/detail',{id:item.id})" v-if="index%2==0">
									<view class="image radius">
										<image :src="item.cover" mode="widthFix"></image>
										<view class="cu-tag text-white">{{item.worksTime}}</view>
									</view>
									<view class="title lg text-cut text-bold padding-tb-xs">{{item.title}}</view>
									<view class="cu-list menu">
										<view class="cu-item">
											<view class="content">
												<image :src="item.avatar" class="png round" mode="aspectFit"></image>
												<text class="text-gray">{{item.name}}</text>
											</view>
											<view class="action text-xl" :class="item.hasliked?'text-red':''">
												<text class="margin-right-xs" :class="'cuIcon-appreciate'+(item.hasliked?'fill':'')"></text>{{item.like}}
											</view>
										</view>
									</view>
								</view>
							</view>
						</view>
						<view class="flex-sub cu-card case lessons waterfall">
							<view class="cu-item" :class="index%2==1?'':'hide'" v-for="(item, index) in explores.works" :key="index">
								<view @click="naviTo('diary/detail',{id:item.id})" v-if="index%2==1">
									<view class="image radius">
										<image :src="item.cover" mode="widthFix"></image>
										<view class="cu-tag text-white">{{item.worksTime}}</view>
									</view>
									<view class="title lg text-cut text-bold padding-tb-xs">{{item.title}}</view>
									<view class="cu-list menu">
										<view class="cu-item">
											<view class="content">
												<image :src="item.avatar" class="png round" mode="aspectFit"></image>
												<text class="text-gray">{{item.name}}</text>
											</view>
											<view class="action text-xl" :class="item.hasliked?'text-red':''">
												<text class="margin-right-xs" :class="'cuIcon-appreciate'+(item.hasliked?'fill':'')"></text>{{item.like}}
											</view>
										</view>
									</view>
								</view>
							</view>
						</view>
					</view>
					<view v-else class="text-center text-gray" @click="naviTo('index/post')">
						<text class="text-empty">没有找到好的作品，赶快<text class="text-blue">发布一篇</text> </text>
					</view>
					<view style="height: 30rpx;"></view>
				</view>
				<view class="bg-gray" v-else>
					<view class="cu-card dynamic" v-if="explores.diarys.length>0">
						<view @click="naviTo('diary/detail',{id:item.id})" class="cu-item shadow" v-for="(item, index) in explores.diarys" :key="index">
							<view class="cu-list menu-avatar">
								<view class="cu-item">
									<view class="cu-avatar round lg" :style="'background-image:url('+item.avatar+');'"></view>
									<view class="content flex-sub">
										<view>{{item.name}}</view>
										<view class="text-gray text-sm flex justify-between">
											<text>{{item.worksTime}}</text>
											<text class="padding-left">已打卡{{item.combo}}天</text>
										</view>
									</view>
								</view>
							</view>
							<view class="text-content margin-top-xs">
								{{item.content}}
							</view>
							<view class="diary-video padding-lr padding-bottom-sm" v-if="item.videourl!=''">
								<view class="bg-img only-img bg-video" :style="'background-image:url('+item.cover+');'"></view>
							</view>
							<view class="grid flex-sub padding-lr padding-bottom-sm" v-if="item.pics.length>0" :class="['col-'+item.col,(item.col>1?'grid-square':'')]">
								<view class="bg-img" :class="item.col>1?'':'only-img'" :style="'background-image:url('+pic+');'" v-for="(pic,key) in item.pics" :key="key">
								</view>
							</view>
							<view class="diary-tags padding-lr" v-if="item.tags.length>0">
								<view class="cu-tag round bg-orange light" v-for="(tag, key) in item.tags" :key="key">
									<text>{{tag}}</text>
								</view>
							</view>
							<view class="text-gray text-lg flex justify-end padding padding-top-sm">
								<view>
									<text class="cuIcon-attention margin-lr-xs"></text> {{item.views}}
								</view>
								<view>
									<text class="margin-right-xs margin-left-sm" :class="item.hasliked?'cuIcon-appreciatefill text-yellow':'cuIcon-appreciate'"></text> {{item.like}}
								</view>
								<view>
									<text class="cuIcon-message margin-right-xs margin-left-sm"></text> {{item.comments.length}}
								</view>
							</view>
						</view>
					</view>
					<view v-else class="text-center text-gray" @click="naviTo('index/post',{special:2})">
						<text class="text-empty">暂无打卡记录，快去<text class="text-blue">抢沙发</text> </text>
					</view>
				</view>
			</view>
		</view>
		<!-- 登录页面 -->
		<!-- 登录页面 -->
		<!-- 登录页面 -->
		<view class="mainpages page-mine" :class="currentbar=='mine'?'active':''">
			<!-- 登录页面上方 -->
			<view class="mine-top padding-lr padding-bottom padding-top-sm">
				<view class="status_bar" v-if="platform!='h5'"></view>
				<view class="flex justify-end">
					<view class="margin-xs" @click="naviTo('member/setting')">
						<view class="bar-btn btn-cogs"></view>
					</view>
					<view @click="naviTo('member/message')">
						<view class="bar-btn" :class="'btn-msg'+(newMsg>0?'s':'')"></view>
					</view>
				</view>
				<view class="cu-list menu-avatar comment user-card">
					<view class="cu-item" @click="naviTo('member/profile')">
						<view class="cu-avatar round xxl border" :style="'background-image:url('+userinfo.avatar+');'"></view>
						<view class="content">
							<view class="title">
								<view class="text-xxl text-cut" style="max-width: 80%;">{{userName || userinfo.nickname}}</view>
								<image @tap.stop="naviTo('member/vip')" class="png margin-left-sm" :class="userinfo.vipexpired?'vipexpired':''" v-if="userinfo.viplogo!=''" :src="userinfo.viplogo" mode="aspectFit"></image>
							</view>
							<view class="text-cut text-lg text-content">
								ID:{{userId}}
							</view>
						</view>
					</view>
				</view>
				<view class="padding-bottom mine-credit">
					<view class="flex text-white text-center margin-top-xs">
						<view class="flex-twice" @click="naviTo('member/credit',{show:'credit1'})">
							<view class="text-bold text-xl padding-bottom-sm">{{userinfo.credit1}}</view>
							<text>积分</text>
						</view>
						<view class="flex-treble border-left-white" @click="naviTo('member/credit')">
							<view class="text-bold text-xl padding-bottom-sm text-cut"><text class="text-lg">￥</text>{{userinfo.credit2}}</view>
							<text>余额</text>
						</view>
						<view class="padding-top flex-sub">
							<view class="signbtn" v-if="!userinfo.todaysigned" @click="dosign"></view>
							<view v-else class="cu-btn round bg-gradual-yellow sm" @click="dosign">已签到</view>
						</view>
					</view>
				</view>
			</view>
			
			
			<view class="mine-navigation">
				<view v-if="data.vipstate==1" class="mine-vip" @click="naviTo('member/vip')">
					<image class="png" src="@/static/images/img_mine_vip.jpg" mode="aspectFit"></image>
				</view>
				<view class="cu-list menu sm-border lg">
					<!-- 从数据库中读取 讲师中心 到 修改资料-->
					<!-- 用户列表 -->
					<view class="cu-item arrow" v-if="item.status==1" @click="naviTo(item.skip)" v-for="item in userlist">
						<view class="content">
							<image :src="item.imageurl" class="png" mode="aspectFit"></image>
							<text class="text-black">{{item.title}}</text>
						</view>
					</view>
					<view class="cu-item arrow" @click="doLogout">
						<view class="content">
							
							<image src="@/static/images/icon/nav_mine_checkout.png" class="png" mode="aspectFit"></image>
							<text class="text-black">切换账号</text>
						</view>
					</view>
				</view>
			</view>
			<!-- 登录页面的限制所在 -->
			<view class="cu-modal login-modal" :class="!hasLogin?'show':''" v-if="!hasLogin">
				<view class="cu-dialog bg-white">
					<view class="cu-bar justify-end">
						<view class="content">请先登录</view>
					</view>
					<view class="padding-bottom-xl">
						- 您还没登录，请先进行登录再操作 -
					</view>
					<view class="cu-bar">
						<view class="action margin-0 flex-sub solid-left text-red" @tap="naviTo('auth/index',{act:'login'})">确定</view>
						<view class="action margin-0 flex-sub text-green solid-left" @tap="checkoutBar('main')">取消</view>
					</view>
				</view>
			</view>
		</view>
		
		<!-- 页面底部加号 发布 -->
		<view class="cu-modal postdialog" :class="modalName=='postdialog'?'show':''">
			<view class="cu-bg bg-white" @click="modalName=''"></view>
			<view class="cu-dialog">
				<view class="padding-xl text-center" @click="modalName=''">
					<text class="text-bold text-xxl text-black">请选择发布类型</text>
				</view>
				<view class="padding-xl">
					<view class="grid col-2 padding text-center">
						<view class="padding" @click="naviTo('lesson/post')">
							<image src="@/static/images/icon/lector_lesson.png" mode="aspectFit"></image>
							<view class="text-xl padding-sm">课程</view>
						</view>
						<view class="padding" @click="naviTo('special/post')">
							<image src="@/static/images/icon/explore_special.png" mode="aspectFit"></image>
							<view class="text-xl padding-sm">专栏</view>
						</view>
						<view class="padding" @click="naviTo('index/post')">
							<image src="@/static/images/icon/explore_works.png" mode="aspectFit"></image>
							<view class="text-xl padding-sm">作品</view>
						</view>
						<view class="padding" @click="naviTo('index/post',{special:2})">
							<image src="@/static/images/icon/explore_note.png" mode="aspectFit"></image>
							<view class="text-xl padding-sm">日记</view>
						</view>
					</view>
					<view class="padding text-center" @click="modalName=''">
						<view class="cuIcon-bgclose"></view>
					</view>
				</view>
			</view>
		</view>
		
		
		<!-- 所有页面底部  推荐 课程 + 发现 我的  -->
		<view class="cu-bar tabbar bg-white text-gray">
			<view v-if="item.status==1" @click="checkoutBar(item.ident,item.url)" v-for="(item, index) in tabbar" :key="index" class="action" :class="[item.extend,(currentbar==item.ident?'active':'')]">
				<view class="cuIcon-cu-image">					
					<image :src="currentbar==item.ident?item.iconHover:item.icon"></image>										
				</view>				
				<view v-if="item.title">{{item.title}}</view>
				
			</view>
		</view>
	</view>
</template>

<script>
	import {mapState} from 'vuex'
	import core from "@/static/core.js"
	import store from '@/store/index.js'
	import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue"
	import lessons from "@/components/util/lessons.vue"
	import scorebar from "@/components/util/scorebar.vue"
	
	export default {
		components: {uniLoadMore, lessons, scorebar},
		//					id			有没有登录	名字		是不是讲师  
		computed: mapState(['userId', 'hasLogin', 'userName', 'lectorid','newMsg']),
		data() {
			return {
				title: 'Hello',
				currentbar:'main',
				touchStartTime:0,
				modalName:'',
				platform:'h5',
				device:core.device,
				iospay:false,
				exploreshow:'works',
				cardCur:0,
				mainlistcol:4,
				categorycol:4,
				tabCur:0,
				clientos:{
					upgrade:false,
					version:'',
					upgradeurl:'',
					urlschemes:'',
					startupimg:'',
					autolaunch:0
				},
				splash:'/static/splash.jpg',
				inited:false,
				scrollLeft: 0,
				shopstate:0,
				keyword:'',
				vipstate:0,
				contentText:{
					"contentdown":"加载更多数据",
					"contentrefresh":"加载中...",
					"contentnomore":"我是有底线的~"
				},
				loadmore:{
					"main":"more",
				},
				recommends:[],
				page:{
					"main":1,
				},
				scrollTops:{
					"main":0,
					"lesson":0,
					"explore":0,
					"mine":0,
					"scrolling":false
				},
				explores:{
					inited:0,
					lectors:[],
					goods:[],
					works:[],
					diarys:[],
					entrys:{
						lesson:1,
						special:1,
						lector:1,
						shop:1,
						works:1,
						diary:1
					}
				},
				"slideshow":{},
				"userlist":{},
				"menu":{},
				"tabbar":{},
				typelist:{},
				data:{
					"title": "首页",
					"releasedate":0,
					"advs": [],
					"specials": [],
					"tags": [],
					"lessons": {},
					"excellentLessons":{},
					"lecturer":{},
					"lessonss":{
						index:0
					},
					"navs":{
						"main":[],
						"tabbar":[],
						"member":[]
					},
					"categorys":[],
					"shareinfo":{
						"title":"",
						"desc":"",
						"cover":"",
						"url":""
					},
					vipstate:0,
					candidate:'',
				},
				"userinfo":{
					"avatar":"",
					"nickname":"未登录",
					"uid":0,
					"vid":0,
					"vipexpired":false,
					"viplogo":"",
					"credit1":"----",
					"credit2":"----",
					"todaysigned":0,
					"newmsg":1
				}
			}
		},
		onLoad() {
			console.log(this.userinfo.todaysigned);
			 this.platform = core.platform;
			 if(typeof(core.system.defaultimg)!='undefined') this.userinfo.avatar = core.system.defaultimg;
			 if(typeof(core.system.splash)!='undefined' && core.system.splash!='') this.splash = core.system.splash;
			 this.initData('');
		},
		onShow() {
			this.initExplore();
			this.tabSelect(this.tabCur);
		},
		onShareAppMessage(e){
			return {
				title:this.data.shareinfo.title,
				path:core.page(this.data.url),
				imageUrl:this.data.shareinfo.cover,
				desc:this.data.shareinfo.desc
			}
		},
		onPullDownRefresh(){
			// this.initData('');
			this.initExplore();
			uni.stopPullDownRefresh();
		},
		onReachBottom(){
			if(this.loadmore[this.currentbar]=='noMore') return false;
			var that = this;
			if(this.currentbar=='main'){
				var postdata = {page:(this.page.main+1)};
				if(this.tabCur==0){
					postdata.isrecommend = 1;
				}else if(this.tabCur==-1){
					postdata.myfocus = 1;
				}else{
					postdata.tid = this.tabCur;
				}
				core.get('lesson',function(res){
					if(typeof(res.message)!='undefined' && typeof(res.type)!='undefined') return core.report(res);
					that.data.lessons = that.data.lessons.concat(res.lessons);
					that.page.main += 1;
					if(res.lessons.length<15){
						that.loadmore.main = 'noMore';
					}
				},postdata,'json',true);
			}
		},
		methods: {
			initData(route, data={}, callback=false){
				var that = this;
				/**
				 * 调用页面菜单的功能
				 */
				this.initMenu();
				/**
				 * 调用用户列表
				 */
				this.initUserList();
				/**
				 * 调用轮播图
				 */
				this.initSlideShow();
				/**
				 * 调用主页面底部
				 */
				this.initbot();
				/**
				 * 给userinfo赋值
				 */
				that.userinfo=core.userinfo;
				/**
				 * 加载数据中。。。
				 */
				if(!core.inited) {
					core.inithandel = function(){
						that.initData('');
						core.inithandel = null;
						
					}
					return core.toast('初始化中...');
				}
				//页面加载时 为空
				this.iospay = core.system.iospay;
				if(typeof(core.system.client)!='undefined'){
					this.clientos = core.system.client;
				}
				if(core.system.splash!='') this.splash = core.system.splash;
				
				that.page = {
					"main":1,
					"lesson":1,
				};
				that.modalName = '';
				that.tabCur = 0;
				// that.data.navs.tabbar=res.navs.tabbar;
				// store.commit('setnewmsg',res.userinfo.newmsg);
				that.shopstate = core.system.shopstate;
				// that.keyword = res.candidate;
				that.inited = true;
				 that.recommends = (0,4);
				that.loadmore.main = 'noMore';
				that.vipstate = core.system.vipstate;
				that.mainlistcol = 3;
				that.categorycol = 3;
				// uni.setNavigationBarTitle({
				// 	title:res.title
				// });
				
				
				// core.get(route,function(res){
				// 	if(typeof(res.message)!='undefined' && typeof(res.type)!='undefined'){
						
				// 		return core.report(res);
				// 	}
				// 	that.page = {
				// 		"main":1,
				// 		"lesson":1,
				// 	};
				// 	that.modalName = '';
				// 	that.tabCur = 0;
				// 	that.data.navs.tabbar=res.navs.tabbar;
				// 	console.log(res)
				// 	store.commit('setnewmsg',res.userinfo.newmsg);
				// 	that.shopstate = core.system.shopstate;
				// 	that.keyword = res.candidate;
				// 	that.inited = true;
				// 	that.recommends = res.lessons.slice(0,4);
				// 	that.loadmore.main = res.lessons.length<15 ? 'noMore' : 'more';
				// 	that.vipstate = core.system.vipstate;
				// 	if(res.releasedate!=core.system.releasedate) core.initsys();
				// 	that.mainlistcol = 4;
				// 	if(res.navs.main.length==3 || res.navs.main.length==6) that.mainlistcol = 3;
				// 	if(res.navs.main.length==5) that.mainlistcol = 5;
				// 	that.categorycol = 4;
				// 	if(res.categorys.length==3 || res.navs.main.length==6) that.categorycol = 3;
				// 	if(res.categorys.length==5) that.categorycol = 5;
				// 	uni.setNavigationBarTitle({
				// 		title:res.title
				// 	});
				// 	if(callback){
				// 		callback(res);
				// 	}
				// },data);
				/**
				 * 调用
				 */
				this.infoList();
				/**
				 * 延迟执行
				 */
				setTimeout(()=>{
					/**
					 * 调用课程目录
					 */
					this.tabSelect(0)
					
				},800);
				/**
				 * 调用优秀课程
				 */
				this.selByStudyNumber();
				if(core.platform!='app' && typeof(this.clientos.autolaunch)!='undefined'){
					if(this.clientos.autolaunch==1){
						core.launchapp(this.clientos.urlschemes,'index/index');
					}
				}
			},
			/**
			 * 查询优秀作品
			 */
			async selByStudyNumber(){
				(await this.$api.reqGet({
					url:"menu/selByStudyNumber"
				}).then(res=>{
					this.data.excellentLessons=res.data;
				}))
			},
			/**
			 * 日记查询
			 */
			async LoadList(){
				var that=this;
				if(core.userinfo.uid>0){
					var likeCecord=(await this.$api.reqGet({
						url: "menu/selLike/"+core.userinfo.uid,
					})).data;
				}else{
					var likeCecord=[]
				}
				this.$api.reqGet({
					url:"works/selWorks/0/2/0/1"
				}).then(
					res => {
						if(res.code==4001||res.code==4002){
							this.explores.diarys=[];
						}else{
							that.explores.diarys=res.data;
							for(let i=0;i<this.explores.diarys.length;i++){
								this.explores.diarys[i].tags = JSON.parse(this.explores.diarys[i].tags);
								this.explores.diarys[i].pics= JSON.parse(this.explores.diarys[i].pics);
							}
							//查询当前用户点赞的作品
							// if(core.userinfo.uid>0){
								// var likeCecord=(this.$api.reqGet({
								// 	url: "menu/selLike/"+core.userinfo.uid,
								// })).data;
								if(likeCecord.length>0){
									for(var i=0;i<likeCecord.length;i++){
										for(var j=0;j<this.explores.diarys.length;j++){
											if(this.explores.diarys[j].id==likeCecord[i].worksid){
												this.explores.diarys[j].hasliked =true;
											}
										}
									}
								}
							// }
						}
					}
				)
			},
			/**
			 * @param {Object} view
			 * 查询全部作品 显示 用户点赞过的作品为点赞后
			 */
			async infoWorks(view){
				//查询全部作品
				var a=(await this.$api.reqGet({
					url:"works/selWorks/0"+"/"+view+"/0/1"
				})).data;
				this.explores.works=a;
				var that=this;
				//查询当前用户点赞的作品
				if(core.userinfo.uid!=null){
					var likeCecord=(await this.$api.reqGet({
						url: "menu/selLike/"+core.userinfo.uid,
					})).data;
					for(var i=0;i<likeCecord.length;i++){
						for(var j=0;j<this.explores.works.length;j++){
							if(this.explores.works[j].id==likeCecord[i].worksid){
								this.explores.works[j].hasliked = !(this.explores.works[j].hasliked);
							}
						}
					}
				}
			},
			/**
			 * 查询课程类型
			 */
			async infoList(){
				var that=this;
				that.typelist=(await this.$api.reqGet({
					url:"menu/selCourseType/1",
				})).data;
			},
			//主页面菜单
			async initMenu(){
				var that = this;
				that.menu=(await this.$api.reqGet({
					url:"menu/list"
				})).data;
			},
				//用户列表
			async initUserList(){
				var that = this;
				that.userlist=(await this.$api.reqGet({
					url:"user/list",
				})).data;
			},
				//轮播图
			async initSlideShow(){
				var that = this;
				that.slideshow=(await this.$api.reqGet({
					url:"menu/slideshow",
				})).data;
			},
			//主页面底部
			async initbot(){
				var that = this;
				that.tabbar=(await this.$api.reqGet({
					url:"menu/tab"
				})).data;
			},
			/**
			 * 优秀讲师与作品 日记
			 */
			async initExplore(){
				this.explores.inited = 1;
				var that = this;
				//作品调用
				setTimeout(()=>{
					this.infoWorks(1)
					this.LoadList();
				},800);
				/*以上是原来代码  下面是自添uni.request 封装   发现页优秀讲师数据*/
				that.data.lecturer=(await this.$api.reqGet({
					url:"/lecturer/selExc",
				})).data;
			},
			/**
			 * @param {Object} e轮播图
			 */
			cardSwiper(e) {
				this.cardCur = e.detail.current
			},
			/**
			 * 扫码判断 是否为 APP
			 */
			doscan(){
				return core.scan();
			},
			/**
			 * 登录
			 */
			dosign(){
				// console.log(
				this.$api.reqGet({
					url:"/user/getTime/"+'?uId='+this.userinfo.uid,
				}).then(res=>{
					this.userinfo.todaysigned=res.data;
					console.log(this.userinfo.todaysigned);
				if(this.userinfo.todaysigned === 2){
					return core.toast('已签到，明天再来吧~');
				}
				if(this.userinfo.todaysigned === 1){					
					console.log(this.userinfo.todaysigned)
					 return core.toast('签到成功');
				}
				});
				//);
				// if(!this.hasLogin) return core.toast('请先登录','login');
				
				
				
				// var that = this;
				// return core.get('member/sign',function(res){
				// 	if(res.type!='success') return core.report(res);
				// 	core.toast(res.message,'','success');
				// 	that.userinfo.todaysigned = true;
				// 	that.initData('');
				// });
			},
			doLogout(){				
				var that = this;
				return core.confirm('确定要退出当前账号重新登录吗？','切换账号',function(){
					if(core.logout()){
						that.userinfo = {
							"avatar":"",
							"nickname":"未登录",
							"uid":0,
							"credit1":"----",
							"credit2":"----",
							"todaysigned":false,
							"newmsg":1
						};
						//  #/pages/auth/index?act=login
						core.navito('auth/index',{act:'login'});
					}
				});
			},
			async tabSelect(e) {
				if(e.currentTarget!=null){
					var tid = e.currentTarget.dataset.id;
				}else{
					var tid = e;
				}
				this.tabCur = tid;
				 this.data.lessons = {};
				 var that = this;
				  var postdata = {page:1,getlessons:1}
				  if(tid==0){
				  	postdata.isrecommend = 1;
				  }else{
				  	postdata.tid  = tid;
				  }
				if(tid==-1){
					that.data.lessons = (await this.$api.reqGet({url:"/menu/courseInfoByUid/"+core.userinfo.uid})).data;
				}else{
					// 必须加的    main.js对应的 {url:"",method:"POST",data:""}
					that.data.lessons = (await this.$api.reqGet({url:"/menu/courseInfo/"+tid})).data;
				}
			},
			naviTo(page,data={}){
				if(page=='lector/console'){
					 return core.toast('暂未开放');
				}
				return core.navito(page,data);
			},
			/**
			 * 跳转页面
			 */
		checkoutBar(cur='main',url=''){
			if(cur=='' && url!='') return this.naviTo(url);
			if(cur=='postdialog') return this.modalName='postdialog';
			if(typeof(this.scrollTops[cur])=='undefined' && cur!='') return false;
			if(this.currentbar==cur) return;
			this.scrollTops.scrolling = true;
			var ScrollTop = this.scrollTops[cur];
			this.currentbar = cur;
			if(cur=='explore' && this.explores.inited==0){
				this.initExplore();
			}
		}
		}
	}
</script>

<style>
	.loadimage{position: fixed; width: 100%; height: 100%; left: 0; top: 0; z-index: 10000;}
	.loadimage image{width: 100%; height: 100%;}
	.cu-bar.tabbar .action.add-action::after{width: 56px; height: 56px; top: -20px; border-radius: 50%;}
	.cu-bar.tabbar .action.add-action [class*="cuIcon-"]{width: 46px; height: 46px; top: -15px;}
	.cu-bar.tabbar .action.add-action image{width: 100% !important; height: 100% !important;}
	.mainpages{display: none; background: #FFFFFF;}
	.mainpages.page-main{background: #F7F6F5;}
	.mainpages.active{display: block;}
	.wp-blur .mainpages, .wp-blur .cu-bar.tabbar{filter: blur(20upx);}
	.card-swiper{height: 13rem !important;}
	.card-swiper swiper-item{padding: 20upx 0upx 40upx;}
	.main-top{background: #fff url(@/static/images/bg_homepage_top.png) no-repeat center -50upx; background-size: 100% auto;}
	.main-top .cu-list{padding-top: 0;}
	.main-top .cu-item .png{height: 2.31rem; width: 2.31rem;}
	.main-top .cu-bar .search-form{display: block; color: #BBB8B4; font-size: 26upx; margin-right: 50upx;}
	.bar-btn{height: 52upx; width: 52upx; background: url(@/static/images/icon/top_scan.png) no-repeat center; background-size:contain; display: block; margin-right: 30upx;}
	.bar-btn.btn-msgs{background-image: url(@/static/images/icon/top_msgs.png); margin-right: 0; height: 64upx; width: 64upx;}
	.bar-btn.btn-msg{background-image: url(@/static/images/icon/top_msg.png); margin-right: 0;}
	.bar-btn.btn-cogs{background-image: url(@/static/images/icon/top_cogs.png);}
	.main-top .bar-btn.btn-msg{height: 60upx; width: 60upx;}
	.wp-wxapp .cu-bar.search{margin-right: 200upx;}
	.specials .special-scroll .cu-card{white-space: nowrap; width: auto; overflow: auto hidden; padding-right: 10px;}
	.specials .special-scroll .cu-item{display: inline-block; width: 80%; margin-top: 5px;}
	.explore-top{padding-bottom: 25px; overflow: hidden; position: relative;}
	.explore-top::before{background: #FFEAB8; position: absolute; width: 400vw; height: 400vw; left: 50%; margin-left: -200vw; border-radius: 50%; content: " "; bottom: 0;}
	.wp-wxapp .explore-top .status_bar{padding-top: 120upx;}
	.explore-top .cu-list{white-space: nowrap; padding: 10px 5px; text-align: center; padding-bottom: 0upx; background: #FFEAB8;}
	.explore-top .cu-item{display: inline-block; padding-top: 5px; padding-bottom: 10px;-webkit-transition-duration: 0s; transition-duration: 0s; -webkit-box-orient: vertical; -webkit-box-direction: normal; -webkit-flex-direction: column; flex-direction: column; width: 18.5%;}
	.explore-top .cu-item .png{width: 2.34rem; height: 2.34rem;}
	.explore-top .cu-item text {display: block; margin-top: 10upx; color: #444444; line-height: 20px; font-size: 0.69rem;}
	.mine-top{background:linear-gradient(180deg,rgba(255,201,77,1) 0%,rgba(255,153,0,1) 100%) no-repeat center -50upx; background-image: url(@/static/images/bg_top_mine.png); background-size: 100% auto;}
	.mine-top .mine-credit .text-xl{font-size: 1.39rem;}
	.mine-top .mine-credit .text-xl .text-lg{font-weight: normal;}
	.mine-top .mine-credit .border-left-white::before{height: 70upx; margin-top: -35upx; top: 50%; background: #FFDD8F;}
	.mine-top .cu-item{background: none !important; color: #ffffff; height: 160upx;}
	.mine-top .cu-item::after{display: none;}
	.mine-top .cu-item .cu-avatar.xxl{width: 140upx; height: 140upx;}
	.mine-top .cu-item .content{left: 200upx;}
	.mine-top .cu-item .content .title .png{height: 40upx; vertical-align: middle; display: inline-block; width: 46upx;}
	.mine-top .btn-msgs{background-image: url(@/static/images/icon/top_msgs_white.png);}
	.mine-top .btn-msg{background-image: url(@/static/images/icon/top_msg_white.png); margin-top: 10upx;}
	.wp-app .mine-top .cu-item .content{padding-left: 0upx;}
	.wp-wxapp .mine-top .status_bar + .justify-end{margin-right: 200upx;}
	.mine-navigation{background: #FF9900;}
	.mine-navigation .cu-list.lg{padding: 20upx; background: #FFFFFF;border-radius:1.6rem 1.6rem 0rem 0rem;}
	.mine-navigation .cu-list.lg .cu-item{padding: 18upx; padding-right: 90upx;}
	.mine-navigation .cu-list.lg .png{width: 1.65rem; height: 1.65rem; margin-right: 20upx;}
	.mine-navigation .cu-list.lg  .text-black{font-weight: 500; color: #666666; font-size: 30upx; font-family:PingFangSC-Medium,PingFang SC;}
	.mine-vip .png{height: 2.15rem; width: 17.2rem; display: block; margin: 0 auto;}
	.postdialog{background: none;}
	.postdialog .cu-bg{position: absolute; width: 100%; height: 100%; left: 0; top: 0; opacity: 0.77;}
	.postdialog .cu-dialog{background: none;}
	.postdialog .grid > .padding image{width: 150upx; height: 150upx;}
</style>
